#include <iostream>
#include <cstdio>
#include <queue>
using namespace std;
typedef long long ll;
int n, m, d;
priority_queue<int, vector<int>, less<int> > q;
int main()
{
    ll sum = 0; //用于统计总血量(首先统计)
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin >> n >> m >> d;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        sum += a;
        q.push(a);
    }
    while (m-- && !q.empty())
    {
        int a = q.top();
        q.pop();
        if (a > d) //打不死，给他打残之后放回去重新排
        {
            sum -= d;
            q.push(a - d);
        }
        else
            sum -= a; //打死
    }
    cout << sum;
    return 0;
}